import { Controller } from "../../mvc/core/Controller";
import { ILoginNoticeModule } from "../../../modules/interfaces/ILoginNoticeModule";
import { DailyRule } from "../rules/DailyRule";
import { ParamsConst } from "../../common/global/ParamsConst";
import { ProxyType } from "../../common/global/ProxyType";
import { PhoneGiftIcon } from "../view/loginNotice/PhoneGiftIcon";
import { ResFileConst } from "../resource/ResFileConst";
import { DataEvent } from "../events/DataEvent";
import { PulseSharedObject } from "../view/player/PulseSharedObject";
import { IView } from "../../mvc/interfaces/IView";
import { LoginNoticeModule } from "../../../modules/LoginNoticeModule";
import { WindowEvent } from "../../component/window/WindowEvent";
import { MessageBlock } from "../../../Framework/MQ/MessageBlock";
import { SAttribute } from "../../../Message/Public/SAttribute";
import { SMoney } from "../../../Message/Game/SMoney";
import { SPanicBuyItemMsg } from "../../../Message/Game/SPanicBuyItemMsg";
import { SPanicBuyRefreshMsg } from "../../../Message/Game/SPanicBuyRefreshMsg";
import { Dispatcher } from "../../mvc/core/Dispatcher";
import { EventName } from "../mvc/EventName";
import { ModuleType } from "../view/common/ModuleType";
import { SSpecialActiveAllCode } from "../../../Message/Public/SSpecialActiveAllCode";
import { ClockManager } from "../manager/ClockManager";
import { LoginOpenServerIcon } from "../view/loginNotice/LoginOpenServerIcon";
import { DailySpecialInfo } from "../model/DailySpecialInfo";
import { SSeqSActiveNumber } from "../../../Message/Public/SSeqSActiveNumber";
import { GameProxy } from "../mvc/GameProxy";
import { Alert } from "../../../com/mui/controls/Alert";
import { Language } from "../../../extend/language/Language";
import { DailySpecialCodeInfo } from "../model/DailySpecialCodeInfo";
import { HTMLUtil } from "../../../com/gengine/utils/HTMLUtil";
import { ColorConfig } from "../resource/ColorConfig";
import { MsgManager } from "../manager/MsgManager";
import { SSeqReward } from "../../../Message/Public/SSeqReward";
import { ItemConfig } from "../resource/ItemConfig";
import { SpecialGiftGetWindow } from "../view/daily/specialGift/SpecialGiftGetWindow";
import { SActiveToClient } from "../../../Message/Public/SActiveToClient";
import { RechargeData } from "../view/loginNotice/OpenRecharge/RechargeData";
import { PhoneGiftModule } from "../../../modules/PhoneGiftModule";
import { NetDispatcher } from "../../mvc/core/NetDispatcher";
import { ServerCommand } from "../mvc/ServerCommand";
import { EGateCommand } from "../../../Message/Command/EGateCommand";
import { RolePlayer } from "../scene/player/entity/RolePlayer";
import { PlayerEvent } from "../scene/events/PlayerEvent";
import { Cache } from "../cache/Cache";
import { LoginSevenDaysHintBtn } from "../view/loginNotice/loginSevenDays/LoginSevenDaysHintBtn";
import { ECareer } from "../../../Message/Public/ECareer";
import { EffectManager } from "../manager/EffectManager";
import { CutDataUtil } from "../../common/tools/CutDataUtil";
import { FilterConst } from "../../component/gconst/FilterConst";
type int = number;
//class LoginNoticeController
    
    export  class LoginNoticeController extends Controller
    {
       

        public showGift(): void
        {
            if (view.isHide) 
            {
                view.show();
                (view as ILoginNoticeModule).changeTabBarByType(DailyRule.WelfareGet);
            }
            else 
            {
                view.hide();
            }
            return;
        }

        /* internal  */showPhoneGiftIcon(): void
        {
            if (ParamsConst.instance.proxyType == ProxyType.P360 && ParamsConst.instance.mobile360Url && !(ParamsConst.instance.mobile360Url == "") && !cache.daily.isMobile360Used) 
            {
                if (this._phoneGift == null) 
                {
                    this._phoneGift = new PhoneGiftIcon(ResFileConst.phoneGiftBtn);
                    this._phoneGift.updateIconInfo();
                }
                this._phoneGift.show();
            }
            else if (ParamsConst.instance.phoneUrl && !(ParamsConst.instance.phoneUrl == "") && !cache.daily.phoneGiftUsed) 
            {
                if (this._phoneGift == null) 
                {
                    this._phoneGift = new PhoneGiftIcon(ResFileConst.phoneGiftBtn);
                    this._phoneGift.updateIconInfo();
                }
                this._phoneGift.show();
            }
            return;
        }

        /* internal  */onLoginGameSuccessHandler(arg1: DataEvent): void
        {
            if (cache.loginNotice.isChangeVersion()) 
            {
                if (ParamsConst.instance.updateUrl != "-1") 
                {
                    PulseSharedObject.saveValue(cache.loginNotice.versionKey, ParamsConst.Version);
                    if (cache.role.entityInfo.level >= 20) 
                    {
                        this.loadVersionData();
                        if (view.isHide) 
                        {
                            view.show();
                            (view as ILoginNoticeModule).changeTabBarByType(DailyRule.LoginNotice);
                        }
                    }
                }
                if (ParamsConst.Version == "1.0.4.8" && cache.role.entityInfo.level >= 40) 
                {
                    cache.guide.petVersionChange = true;
                    this._loginCallLater = true;
                }
                else if (ParamsConst.Version == "1.0.5.8" && cache.role.entityInfo.level >= 65) 
                {
                    cache.guide.petEquipRefresh = true;
                    this._loginCallLater = true;
                }
            }
            this.showPhoneGiftIcon();
            return;
        }

        protected /* override */ initView(): IView
        {
            var loc1=new LoginNoticeModule();
            loc1.addEventListener(WindowEvent.SHOW, this.onWindowShowHandler);
            loc1.addEventListener(WindowEvent.CLOSE, this.onWindowCloseHandler);
            return loc1;
        }

        /* internal  */loadVersionData(): void
        {
            this._loadReq = true;
            cache.loginNotice.loadDataFromPhp(ParamsConst.instance.updateUrl, this.onUpdateDataLoaded);
            return;
        }

        /* internal  */onUpdateDataLoaded(): void
        {
            (view as ILoginNoticeModule).updataVersion(cache.loginNotice.noticeMsg, cache.loginNotice.addList, cache.loginNotice.updateList);
            return;
        }

        /* internal  */onVipInfoUpdate(arg1: Object): void
        {
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updateVIPInfo(cache.vip.vipInfo);
            }
            return;
        }

        /* internal  */onVipBlessStateUpdate(arg1: Boolean): void
        {
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updateVIPBlessState(arg1);
            }
            return;
        }

        /* internal  */onCopyNumChangeRes(arg1: Object): void
        {
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updateCopyOffInfo();
            }
            return;
        }

        /* internal  */onContinuousLoadHandler(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SAttribute;
            cache.daily.sAttribute = loc1;
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updateContinuousLoadInfo(loc1);
            }
            return;
        }

        /* internal  */onGetTimeSuccessHandler(arg1: Object): void
        {
            cache.daily.offLineTime = int(arg1.time);
            cache.daily.offLineExp = Number(arg1.exp);
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updateOffLine();
            }
            return;
        }

        /* internal  */onBackPackChangeHandler(arg1: Object): void
        {
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updatePackItem();
            }
            return;
        }

        /* internal  */onMoneyUpdateHandler(arg1: SMoney=null): void
        {
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).udpateRoleMoney(cache.role.money);
            }
            return;
        }

        /* internal  */onGetPanicBuyConfigSuccessHandler(arg1: DataEvent): void
        {
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updatePanicBuyItemMsg(cache.shop.refreshMsg);
            }
            return;
        }

        /* internal  */onPanicBuyItemUpdateHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as SPanicBuyItemMsg;
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updatePanicBuyItem(loc1);
            }
            return;
        }

        /* internal  */onPanicBuyRefreshHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as SPanicBuyRefreshMsg;
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).updatePanicBuy(loc1);
            }
            return;
        }

        /* internal  */onShopMallCostReturnUpdateHandler(arg1: int): void
        {
            return;
        }

        /* internal  */onWindowShowHandler(arg1: WindowEvent): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.GetPanicBuyConfig));
            this.onMoneyUpdateHandler();
            this.onShopMallCostReturnUpdateHandler(cache.role.costReturn);
            if (!this._loadReq) 
            {
                this.loadVersionData();
            }
            return;
        }

        /* internal  */onWindowCloseHandler(arg1: WindowEvent): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ClosePanicBuy));
            if (this._loginCallLater) 
            {
                this._loginCallLater = false;
                if (cache.guide.petVersionChange) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_ModuleOpen, ModuleType.Pets));
                }
                else if (cache.guide.petFightChange) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_PetFightGuide));
                }
                else if (cache.guide.petEquipRefresh) 
                {
                    Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_PetEquipRefresh));
                }
            }
            return;
        }

        /* internal  */onDailyGiftOpenHandler(arg1: DataEvent): void
        {
            var loc1=0;
            if (view.isHide) 
            {
                view.show();
            }
            else 
            {
                view.layer.setTop(view as Object /* flash.display.DisplayObject */);
            }
            if (arg1.data) 
            {
                loc1 = int(arg1.data);
            }
            else 
            {
                loc1 = DailyRule.WelfareGet;
            }
            (view as ILoginNoticeModule).changeTabBarByType(loc1);
            return;
        }

        /* internal  */cheackOldAct(arg1: SSpecialActiveAllCode): void
        {
            var loc2=null;
            var loc1=arg1.seq;
            var loc3=0;
            while (loc3 < loc1.length) 
            {
                loc2 = loc1[loc3];
                if (loc2.type >= 9 && loc2.type <= 16) 
                {
                    cache.loginNotice.isOldAct = false;
                    return;
                }
                ++loc3;
            }
            cache.loginNotice.isOldAct = true;
            return;
        }

        /* internal  */onActiveAllCodeRes(arg1: MessageBlock): void
        {
            cache.daily.initActiveAllCode(arg1.messageBase as SSpecialActiveAllCode);
            this.cheackOldAct(arg1.messageBase as SSpecialActiveAllCode);
            this.refreshActiveCodeList();
            return;
        }

        /* internal  */onActiveUpdateRes(arg1: MessageBlock): void
        {
            cache.daily.initActiveAllCode(arg1.messageBase as SSpecialActiveAllCode);
            this.cheackOldAct(arg1.messageBase as SSpecialActiveAllCode);
            this.refreshActiveCodeList();
            return;
        }

        /* internal  */refreshActiveCodeList(): void
        {
            if (cache.daily.nextRefreshDate != null) 
            {
                ClockManager.instance.removeDateCall(cache.daily.nextRefreshDate);
            }
            if (cache.daily.maxActiveEndTime) 
            {
                ClockManager.instance.removeDateCall(cache.daily.maxActiveEndTime);
            }
            cache.daily.updateActiveCodeList();
            if (cache.daily.nextRefreshDate != null) 
            {
                ClockManager.instance.addDateCall(cache.daily.nextRefreshDate, this.refreshActiveCodeList);
            }
            if (cache.daily.maxActiveEndTime) 
            {
                ClockManager.instance.addDateCall(cache.daily.maxActiveEndTime, this.refreshActiveCodeList);
            }
            if (_view && !_view.isHide) 
            {
                (view as ILoginNoticeModule).checkTabBar();
                (view as ILoginNoticeModule).onActiveListRes();
            }
            if (cache.daily.hasOpenServerAct) 
            {
                this.cheackOpenSeverHintBtnShine();
            }
            else if (LoginOpenServerIcon.hasInstance()) 
            {
                LoginOpenServerIcon.instance.hide();
            }
            return;
        }

        /* internal  */onActiveDetailReqRes(arg1: DataEvent): void
        {
            var loc1=null;
            if (_view && !_view.isHide) 
            {
                loc1 = arg1.data as DailySpecialInfo;
                (view as ILoginNoticeModule).onActiveDetailRes(loc1);
            }
            return;
        }

        /* internal  */onSpecialGiftInfoUpdate(arg1: MessageBlock): void
        {
            cache.loginNotice.initSpeciaAllInfos(arg1.messageBase as SSeqSActiveNumber);
            this.refreshSpecialGiftInfo();
            return;
        }

        /* internal  */refreshSpecialGiftInfo(): void
        {
            if (cache.loginNotice.nextRefreshDate != null) 
            {
                ClockManager.instance.removeDateCall(cache.loginNotice.nextRefreshDate);
            }
            cache.loginNotice.updateSpecialInfos();
            if (cache.loginNotice.nextRefreshDate != null) 
            {
                ClockManager.instance.addDateCall(cache.loginNotice.nextRefreshDate, this.refreshSpecialGiftInfo);
            }
            if (_view && !_view.isHide) 
            {
                (_view as ILoginNoticeModule).checkTabBar();
                (_view as ILoginNoticeModule).updateSpecialGift();
            }
            return;
        }

        /* internal  */onSpecialGiftPlayerInfoUpdate(arg1: MessageBlock): void
        {
            cache.loginNotice.updateSpecialInfoNum(arg1.messageBase as SAttribute);
            if (_view && !_view.isHide) 
            {
                (_view as ILoginNoticeModule).updateSpecialGiftNum();
            }
            return;
        }

        /* internal  */onActiveDetailReqReq(arg1: DataEvent): void
        {
            var loc1=int(arg1.data);
            if (loc1 != -1) 
            {
                GameProxy.daily.specialDetailInfoReq(loc1);
            }
            return;
        }

        /* internal  */onSpecialGetRewardReq(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=0;
            if (cache.loginNotice.isOldAct) 
            {
                Alert.extendObj = arg1.data;
                Alert.show(Language.getString(20300), Language.getString(20055), Alert.OK | Alert.CANCEL, null, this.onGetSpecialReqAlert);
            }
            else 
            {
                loc1 = arg1.data.info as DailySpecialInfo;
                loc2 = arg1.data.index;
                GameProxy.daily.getSpecialActiveJoinReward(loc1.code, loc2);
            }
            return;
        }

        /* internal  */onGetSpecialReqAlert(arg1: int, arg2: Object): void
        {
            var loc1=null;
            if (arg1 == Alert.OK) 
            {
                loc1 = arg2.info;
                arg1 = arg2.index;
                GameProxy.daily.getSpecialActiveJoinReward(loc1.code, arg1);
            }
            return;
        }

        /* internal  */onSpecialGetRewardRes(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=0;
            var loc3=0;
            var loc4=null;
            var loc5=false;
            var loc6=0;
            var loc7=0;
            var loc8=null;
            if (_view && !_view.isHide) 
            {
                loc1 = arg1.data;
                loc2 = loc1.code;
                loc3 = loc1.index;
                (view as ILoginNoticeModule).onActiveRewardRes(loc2, loc3);
                if (cache.daily.isOpenSever(loc2)) 
                {
                    if (!cache.loginNotice.isOldAct) 
                    {
                        if ((loc4 = cache.loginNotice.openSeverStateDic[loc2]) != null) 
                        {
                            loc4[loc3] = 0;
                            (_view as ILoginNoticeModule).updataGetRewardState(loc2, loc4);
                            if (!(loc5 = this.checkCanGetRewardAndShine(loc4))) 
                            {
                                loc6 = cache.loginNotice.shineCodeList.indexOf(loc2.toString());
                                loc7 = cache.loginNotice.shineCodeList.indexOf(loc2);
                                if (loc6 > -1) 
                                {
                                    cache.loginNotice.shineCodeList.splice(loc6, 1);
                                }
                                if (loc7 > -1) 
                                {
                                    cache.loginNotice.shineCodeList.splice(loc7, 1);
                                }
                                this.shineInList(loc2, false);
                                if (this.checkCanJumpTabBar() > -1) 
                                {
                                    (view as ILoginNoticeModule).jumpTabBar(this.checkCanJumpTabBar());
                                }
                            }
                        }
                    }
                    this.cheackOpenSeverHintBtnShine();
                }
                else if ((loc8 = cache.loginNotice.specialStateDic[loc2]) != null) 
                {
                    loc8[loc3] = 0;
                    (_view as ILoginNoticeModule).updataGetRewardState(loc2, loc8);
                }
            }
            return;
        }

        /* internal  */checkCanJumpTabBar(): int
        {
            var loc3=null;
            var loc1=cache.daily.getActiveTimeCodeByType(true);
            var loc2=cache.loginNotice.openSeverStateDic;
            var loc4=[];
            var loc5=0;
            while (loc5 < loc1.length) 
            {
                loc3 = loc1[loc5] as DailySpecialCodeInfo;
                if (!((loc4 = loc2[loc3.code]) == null) && this.checkCanGetRewardAndShine(loc4)) 
                {
                    return loc5;
                }
                ++loc5;
            }
            return -1;
        }

        /* internal  */onRolePackItemChange(arg1: Object): void
        {
            var loc1=cache.daily.updateSpecialEquipCondition();
            if (loc1 && loc1.length > 0) 
            {
                if (_view && !_view.isHide) 
                {
                    (_view as ILoginNoticeModule).onActiveConditionUpdate(loc1);
                }
            }
            return;
        }

        /* internal  */onPlayerSuitLockedChange(arg1: DataEvent): void
        {
            var loc1=cache.daily.updateSpecialEquipCondition();
            if (loc1 && loc1.length > 0) 
            {
                if (_view && !_view.isHide) 
                {
                    (_view as ILoginNoticeModule).onActiveConditionUpdate(loc1);
                }
            }
            return;
        }

        /* internal  */onSpecialGiftGetReqHandler(arg1: DataEvent): void
        {
            var loc1=0;
            var loc2=null;
            if (arg1.data) 
            {
                loc1 = arg1.data.code as int;
                loc2 = arg1.data.key as string;
                GameProxy.daily.getSpecialGiftReq(loc1, loc2);
            }
            return;
        }

        /* internal  */onSpecialGiftGetResHandler(arg1: DataEvent): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=0;
            var loc5=null;
            var loc6=null;
            if (arg1.data) 
            {
                loc1 = arg1.data as string;
                loc2 = cache.loginNotice.getSpecialGiftInfoByCode(loc1);
                if (loc2) 
                {
                    loc4 = loc2.rewardItems.length;
                    while (loc3 < loc4) 
                    {
                        loc5 = loc2.rewardItems[loc3];
                        loc6 = Language.getStringByParam(25003, loc5.itemAmount, HTMLUtil.addColor(loc5.name, ColorConfig.instance.getItemColorString(loc5.color)));
                        MsgManager.showRollTipsMsg(loc6);
                        ++loc3;
                    }
                }
            }
            return;
        }

        /* internal  */onShowSpecialGiftRewardHandler(arg1: MessageBlock): void
        {
            var loc2=0;
            var loc3=0;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            var loc1=arg1.messageBase as SSeqReward;
            if (loc1) 
            {
                loc3 = loc1.rewards.length;
                while (loc2 < loc3) 
                {
                    loc4 = loc1.rewards[loc2];
                    if (loc6 = ItemConfig.instance.getInfoByCode(loc4.code)) 
                    {
                        loc5 = Language.getStringByParam(25003, loc4.num, HTMLUtil.addColor(loc6.item.name, ColorConfig.instance.getItemColorString(loc6.item.color)));
                        MsgManager.showRollTipsMsg(loc5);
                    }
                    ++loc2;
                }
            }
            if (!SpecialGiftGetWindow.instance.isHide) 
            {
                SpecialGiftGetWindow.instance.hide();
            }
            return;
        }

        /* internal  */onRechargeGiftBagActiveHandler(arg1: SActiveToClient): void
        {
            RechargeData.activeToClient = arg1;
            if (_view && !_view.isHide) 
            {
                (_view as ILoginNoticeModule).updateRechargeGiftBag();
            }
            return;
        }

        /* internal  */onGetOpenRechargeGiftBagHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            GameProxy.roleProxy.getOpenRechargeGiftBag(loc1);
            return;
        }

        /* internal  */onGiftBagHadGetCodesHandler(arg1: DataEvent): void
        {
            GameProxy.roleProxy.hadGetOpenRechargeGiftBag();
            return;
        }

        /* internal  */onGetOpenRechargeGiftBagSuccessHandler(arg1: DataEvent): void
        {
            var loc1=arg1.data as Array<any>;
            RechargeData.hadGetCodes = loc1;
            if (_view && !_view.isHide) 
            {
                (_view as ILoginNoticeModule).updateRechargeGiftBag();
            }
            return;
        }

        /* internal  */onPhoneGiftWindowOpenHandler(arg1: DataEvent): void
        {
            if (this._phoneGiftModule == null) 
            {
                this._phoneGiftModule = new PhoneGiftModule();
            }
            if (this._phoneGiftModule.isHide) 
            {
                this._phoneGiftModule.show();
            }
            else 
            {
                this._phoneGiftModule.hide();
            }
            return;
        }

        /* internal  */onDailyGiftInfoResHandler(arg1: DataEvent): void
        {
            if (ParamsConst.instance.proxyType != ProxyType.P360) 
            {
                if (cache.daily.phoneGiftUsed) 
                {
                    if (this._phoneGift && !this._phoneGift.isHide) 
                    {
                        this._phoneGift.hide();
                    }
                    if (this._phoneGiftModule && !this._phoneGiftModule.isHide) 
                    {
                        this._phoneGiftModule.hide();
                    }
                }
            }
            else if (cache.daily.isMobile360Used) 
            {
                if (this._phoneGift && !this._phoneGift.isHide) 
                {
                    this._phoneGift.hide();
                }
                Dispatcher.dispatchEvent(new DataEvent(EventName.MobileBindClose));
            }
            return;
        }

        protected /* override */ initServer(): void
        {
            Dispatcher.addEventListener(EventName.LoginGameSuccess, this.onLoginGameSuccessHandler);
            NetDispatcher.addCmdListener(ServerCommand.VIPInfoUpdateCommand, this.onVipInfoUpdate);
            NetDispatcher.addCmdListener(ServerCommand.VIPBlessStateChange, this.onVipBlessStateUpdate);
            NetDispatcher.addCmdListener(ServerCommand.Copy_CopyNumInfoChange, this.onCopyNumChangeRes);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateContinuousLoad, this.onContinuousLoadHandler);
            NetDispatcher.addCmdListener(ServerCommand.GetOfflineTimeSuccess, this.onGetTimeSuccessHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.onBackPackChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackpackDataChange, this.onBackPackChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.MoneyUpdate, this.onMoneyUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.ShopMallCostReturnUpdate, this.onShopMallCostReturnUpdateHandler);
            Dispatcher.addEventListener(EventName.GetPanicBuyConfigSuccess, this.onGetPanicBuyConfigSuccessHandler);
            Dispatcher.addEventListener(EventName.PanicBuyItemUpdate, this.onPanicBuyItemUpdateHandler);
            Dispatcher.addEventListener(EventName.PanicBuyRefresh, this.onPanicBuyRefreshHandler);
            Dispatcher.addEventListener(EventName.DailyGiftOpen, this.onDailyGiftOpenHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateSpecialActiveAllCode, this.onActiveAllCodeRes);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateSpecialActiveUpdate, this.onActiveUpdateRes);
            Dispatcher.addEventListener(EventName.DailySpecialDetailInfoRes, this.onActiveDetailReqRes);
            Dispatcher.addEventListener(EventName.DailySpecialDetailInfoReq, this.onActiveDetailReqReq);
            Dispatcher.addEventListener(EventName.DailySpecialGetRewardReq, this.onSpecialGetRewardReq);
            Dispatcher.addEventListener(EventName.DailySpecialGetRewardRes, this.onSpecialGetRewardRes);
            NetDispatcher.addCmdListener(ServerCommand.RolePackItemsChange, this.onRolePackItemChange);
            NetDispatcher.addCmdListener(ServerCommand.RolepackDataChange, this.onRolePackItemChange);
            Dispatcher.addEventListener(EventName.PlayerSuitLockedChange, this.onPlayerSuitLockedChange);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateActiveNumberUpdate, this.onSpecialGiftInfoUpdate);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGatePlayerActiveNumberUpdate, this.onSpecialGiftPlayerInfoUpdate);
            Dispatcher.addEventListener(EventName.SpecialGiftGetReq, this.onSpecialGiftGetReqHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateShowReward, this.onShowSpecialGiftRewardHandler);
            NetDispatcher.addCmdListener(ServerCommand.RechargeGiftBagActiveCommand, this.onRechargeGiftBagActiveHandler);
            Dispatcher.addEventListener(EventName.GetOpenRechargeGiftBag, this.onGetOpenRechargeGiftBagHandler);
            Dispatcher.addEventListener(EventName.GetOpenRechargeGiftBagHadGetCodes, this.onGiftBagHadGetCodesHandler);
            Dispatcher.addEventListener(EventName.GetOpenRechargeGiftBagSuccess, this.onGetOpenRechargeGiftBagSuccessHandler);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateSevenDayLoginReward, this.onGetSevenDaysReward);
            Dispatcher.addEventListener(EventName.GoGetSevenDaysReward, this.onGoGetSevenDaysReward);
            Dispatcher.addEventListener(EventName.OpenLoginSevenDaysView, this.onOpenLoginSevenDaysView);
            RolePlayer.instance.addEventListener(PlayerEvent.RoleLevelUpdate, this.onRoleLevelUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.RoleCareerUpdate, this.onRoleCareerUpdateHandler);
            Dispatcher.addEventListener(EventName.GetSevenDayLoginRewardSuccess, this.onGetSevenDayLoginRewardSuccess);
            NetDispatcher.addCmdListener(EGateCommand._ECmdGateSevenDayOpenServerActive, this.onSevenDayOpenServerActive);
            Dispatcher.addEventListener(EventName.OpenSeverGoShineTabBar, this.onOpenSeverGoShineTabBar);
            Dispatcher.addEventListener(EventName.OpenSeverShowTimeJump, this.onOpenSeverShowTimeJump);
            Dispatcher.addEventListener(EventName.PhoneGiftWindowOpen, this.onPhoneGiftWindowOpenHandler);
            Dispatcher.addEventListener(EventName.DailyGiftInfoRes, this.onDailyGiftInfoResHandler);
            return;
        }

        /* internal  */onOpenSeverShowTimeJump(arg1: DataEvent): void
        {
            return;
        }

        /* internal  */onOpenSeverGoShineTabBar(arg1: DataEvent): void
        {
            var loc1=arg1.data as Array<any>;
            this.stopAllShine();
            var loc2=0;
            while (loc2 < loc1.length) 
            {
                if (cache.loginNotice.openSeverStateDic[loc1[loc2]]) 
                {
                    if (this.checkCanGetRewardAndShine(cache.loginNotice.openSeverStateDic[loc1[loc2]])) 
                    {
                        this.shineInList(loc1[loc2], true);
                    }
                }
                else 
                {
                    this.shineInList(loc1[loc2], true);
                }
                ++loc2;
            }
            return;
        }

        /* internal  */stopAllShine(): void
        {
            var loc2=null;
            var loc1=Cache.instance.daily.getActiveTimeCodeByType(true);
            var loc3=0;
            while (loc3 < loc1.length) 
            {
                loc2 = loc1[loc3];
                (_view as ILoginNoticeModule).openActiveBtnShineOrNot(loc3, false);
                ++loc3;
            }
            return;
        }

        /* internal  */onGetSevenDayLoginRewardSuccess(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            if (!view.isHide) 
            {
                (view as ILoginNoticeModule).flyRewardToPack(loc1);
            }
            return;
        }

        /* internal  */onRoleCareerUpdateHandler(arg1: Object): void
        {
            this.showSevenHintBtn();
            return;
        }

        public get loginSevenHintBtn(): LoginSevenDaysHintBtn
        {
            if (!this._loginSevenHintBtn) 
            {
                this._loginSevenHintBtn = new LoginSevenDaysHintBtn();
            }
            return this._loginSevenHintBtn;
        }

        protected onRoleLevelUpdateHandler(arg1: Object /* flash.events.Event */): void
        {
            this.showSevenHintBtn();
            return;
        }

        /* internal  */showSevenHintBtn(): void
        {
            var loc1=null;
            var loc2=null;
            if (!(cache.role.entityInfo.career == ECareer._ECareerNo) && !(cache.role.entityInfo.career == ECareer._ECareerNewPlayer)) 
            {
                if (cache.role.entityInfo.level >= 30 && cache.loginNotice.seventDaysReward && this.checkState(cache.loginNotice.seventDaysReward.valueStr)) 
                {
                    if (this.canGetReward) 
                    {
                        loc1 = new Object /* flash.filters.GlowFilter */(268435302, 1, 6, 6, 4);
                        loc2 = [loc1];
                        EffectManager.glowFilterReg(this.loginSevenHintBtn, loc2, 0.8, 10, 5, 0);
                    }
                    else 
                    {
                        EffectManager.glowFilterUnReg(this.loginSevenHintBtn);
                    }
                    this.loginSevenHintBtn.show();
                }
                else if (this._loginSevenHintBtn && !this._loginSevenHintBtn.isHide) 
                {
                    this._loginSevenHintBtn.hide();
                    EffectManager.glowFilterUnReg(this._loginSevenHintBtn);
                }
            }
            return;
        }

        /* internal  */checkState(arg1: string): Boolean
        {
            var loc3=false;
            this.canGetReward = false;
            var loc1=arg1.split("#");
            var loc2=[];
            var loc4=0;
            while (loc4 < loc1.length) 
            {
                loc2 = loc1[loc4].split(",");
                if (int(loc2[1]) != 0) 
                {
                    loc3 = true;
                }
                if (int(loc2[1]) == 1) 
                {
                    this.canGetReward = true;
                }
                ++loc4;
            }
            return loc3;
        }

        /* internal  */onOpenLoginSevenDaysView(arg1: DataEvent): void
        {
            if (view.isHide) 
            {
                view.show();
                (view as ILoginNoticeModule).changeTabBarByType(DailyRule.LoginSevenDays);
            }
            else 
            {
                view.hide();
            }
            return;
        }

        /* internal  */onGetSevenDaysReward(arg1: MessageBlock): void
        {
            var loc1=arg1.messageBase as SAttribute;
            cache.loginNotice.seventDaysReward = loc1;
            cache.loginNotice.isSeventDaysCanGetRewards = this.checkState(cache.loginNotice.seventDaysReward.valueStr);
            if (_view && !_view.isHide) 
            {
                (_view as ILoginNoticeModule).updateSevenDays(loc1);
            }
            this.showSevenHintBtn();
            return;
        }

        /* internal  */onGoGetSevenDaysReward(arg1: DataEvent): void
        {
            var loc1=arg1.data as int;
            GameProxy.daily.getSevenDayLoginReward(loc1);
            return;
        }

        /* internal  */onSevenDayOpenServerActive(arg1: MessageBlock): void
        {
            var loc4=0;
            var loc5=null;
            var loc6=0;
            var loc7=null;
            var loc8=null;
            var loc1=arg1.messageBase as SAttribute;
            var loc2=loc1.value;
            var loc3=[];
            if (loc2 != 0) 
            {
                if (cache.daily.isOpenSever(loc2)) 
                {
                    loc7 = [];
                    if (loc2 > 0) 
                    {
                        loc7 = CutDataUtil.getStringValue(loc1.valueStr, 1);
                        cache.loginNotice.openSeverStateDic[loc2] = loc7;
                        if (cache.loginNotice.shineCodeList.indexOf(loc2.toString()) == -1 && cache.loginNotice.shineCodeList.indexOf(loc2) == -1 && this.checkCanGetRewardAndShine(loc7)) 
                        {
                            cache.loginNotice.shineCodeList.push(loc2.toString());
                        }
                        if (_view && !_view.isHide) 
                        {
                            (_view as ILoginNoticeModule).updataGetRewardState(loc2, loc7);
                            if (this.checkCanGetRewardAndShine(loc7)) 
                            {
                                this.shineInList(loc2, true);
                            }
                        }
                    }
                    this.cheackOpenSeverHintBtnShine();
                }
                else 
                {
                    loc8 = [];
                    loc8 = CutDataUtil.getStringValue(loc1.valueStr, 1);
                    cache.loginNotice.specialStateDic[loc2] = loc8;
                    if (_view && !_view.isHide) 
                    {
                        (_view as ILoginNoticeModule).updataGetRewardState(loc2, loc8);
                    }
                }
            }
            else 
            {
                loc5 = CutDataUtil.getStringValueWithoutComma(loc1.valueStr);
                loc6 = 0;
                while (loc6 < loc5.length) 
                {
                    loc4 = loc5[loc6];
                    if (cache.daily.isOpenSever(loc4)) 
                    {
                        loc3.push(loc4);
                    }
                    ++loc6;
                }
                cache.loginNotice.shineCodeList = loc3;
                cache.daily.startRewardArr = loc3;
                this.cheackOpenSeverHintBtnShine();
            }
            return;
        }

        /* internal  */cheackOpenSeverHintBtnShine(): void
        {
            if (cache.daily.isShowOpenServer()) 
            {
                LoginOpenServerIcon.instance.show();
                if (cache.loginNotice.shineCodeList.length > 0 && !LoginOpenServerIcon.instance.isHide) 
                {
                    EffectManager.glowFilterReg(LoginOpenServerIcon.instance, [FilterConst.guideTipsFilter]);
                }
                else 
                {
                    EffectManager.glowFilterUnReg(LoginOpenServerIcon.instance);
                }
            }
            else if (LoginOpenServerIcon.hasInstance()) 
            {
                LoginOpenServerIcon.instance.hide();
            }
            return;
        }

        /* internal  */shineInList(arg1: int, arg2: Boolean): void
        {
            var loc2=null;
            var loc1=Cache.instance.daily.getActiveTimeCodeByType(true);
            var loc3=0;
            while (loc3 < loc1.length) 
            {
                loc2 = loc1[loc3];
                if (arg1 == loc2.code) 
                {
                    (_view as ILoginNoticeModule).openActiveBtnShineOrNot(loc3, arg2);
                }
                ++loc3;
            }
            return;
        }

        /* internal  */checkCanGetRewardAndShine(arg1: Array<any>): Boolean
        {
            var loc1=false;
            var loc2=arg1.length;
            var loc3=0;
            while (loc3 < loc2) 
            {
                if (arg1[loc3] == 1) 
                {
                    loc1 = true;
                }
                ++loc3;
            }
            return loc1;
        }

        private /* var */_loginCallLater: Boolean;

        private /* var */_loadReq: Boolean;

        private /* var */canGetReward: Boolean;

        private /* var */_phoneGift: PhoneGiftIcon;

        private /* var */_phoneGiftModule: PhoneGiftModule;

        private /* var */_loginSevenHintBtn: LoginSevenDaysHintBtn;
    }
